﻿using KingerRobot.PCRBW.Dao;
using KingerRobot.PCRMES.Spi;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace KingerRobot.PCRBW.SpiService;

public class MesOutOrdersImpl : IMesOutOrdersService
{
    IMesOutOrdersRepositories _mesOutOrdersRepositories=new MesOutOrdersRepositories();
    IRcsLocationRepositories _rcsLocationRepositories = new RcsLocationRepositories();

    public int SyncMesOutOrders(MesOutOrder mesOutOrder)
    {
        int result = 0;

        MesOutOrder mesOrder = _mesOutOrdersRepositories.QueryById(mesOutOrder.Id);
        if (mesOrder == null)
        {
            result = _mesOutOrdersRepositories.Add(mesOutOrder);
        }
        else
        {
            result = _mesOutOrdersRepositories.UpdateByOrder(mesOutOrder);
        }
        return result;
    }
}
